#ifndef CORE_CORE_H
#define CORE_CORE_H

/** 
 * Copyright (c) 2011 Mikko Romppainen & Teppo Kauppinen
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
 * and associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
 * do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#include <QVector>
#include <QString>
#include <QHash>
#include <stdint.h>

namespace yam3d
{
namespace core
{
    // TODO: Add typedefs here for base data types and data structures
    //typedef QVector vector;
    typedef QString string;


    typedef uint8_t byte;

    template<class T>
    class vector : public QVector<T>
    {
    };

    template<class T1,class T2>
    class hash : public QHash<T1,T2>
    {
    };

    typedef vector<byte> ByteVector;
    typedef vector<unsigned short> UShortVector;
    typedef vector<unsigned int> UIntVector;
  //  typedef QVector<unsigned int> IntVector;

    /**
     * This is a ticpp exception class
     */
    class Exception : public std::exception
    {
    public:
            /**
            Construct an exception with a message
            */
            Exception( const char* const message, const char* file, int line, const yam3d::core::string& details = yam3d::core::string("") );
            Exception( const yam3d::core::string& message, const char* file, int line, const yam3d::core::string& details = yam3d::core::string("") );
            Exception(const Exception& o );
            Exception& operator =(const Exception& o);

            ~Exception() throw();

            /// Override std::exception::what() to return m_details
            const char* what() const throw();


           // string m_details; /**< Exception Details */
    private:
            char* m_details;
            static char* makeErrorString(const yam3d::core::string& message, yam3d::core::string file, int line, const yam3d::core::string& details);
    };

    /**
    This allows you to stream your exceptions in.
    It will take care of the conversion	and throwing the exception.
    */
    #define YAM3D_THROW( message ) throw yam3d::core::Exception( message, __FILE__, __LINE__ )


#if defined(assert)
    #pragma message("** WARNING! REMOVE assert.h include")
    #undef assert
#endif

#define assert(_Expression) ((_Expression) ? (void)0 : throw yam3d::core::Exception(#_Expression, __FILE__, __LINE__))
#define assert_message(_Expression,msg) ((_Expression) ? (void)0 : throw yam3d::core::Exception(#_Expression, __FILE__, __LINE__,msg))

#define LOG(msg) qDebug(msg)


}
}



#endif // CORE_CORE_H


